import json,csv,yaml
from dotenv import load_dotenv
import os

# yaml格式的数据驱动
def read_yaml(file_name):
    with open(file_name,'r',encoding='utf-8') as f:
        return yaml.safe_load(f)
#json格式的数据驱动
def read_json(file_path):
    with open(file_path,'r',encoding='utf-8') as e:
        return json.load(e)
#csv格式数据驱动
def read_csv(filepath):
    with open(filepath,newline='') as e:
        reader = csv.DictReader(e)
        return [row for row in reader]
#excel格式驱动
def read_env_data():
    load_dotenv()
    return {
        "WMS_USERNAME":os.getenv("WMS_USERNAME"),
        "WMS_PASSWORD":os.getenv('WMS_PASSWORD')
    }